github-markdown-adf 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -2
- package/dist/browser/index.iife.js +25 -25
- package/dist/browser/index.js +16 -16
- package/dist/index.cjs +76 -70
- package/dist/index.d.cts +14 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +14 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +76 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,18 +139,37 @@ import { mdToAdf, adfToMd } from 'github-markdown-adf';
|
|
|
139
139
|
|
|
140
140
|
Converts a GFM string to an ADF document object. Parses using [remark](https://github.com/remarkjs/remark) / [unified](https://github.com/unifiedjs/unified) with full GFM extensions: tables, task lists, strikethrough, and GitHub Alert syntax (`> [!NOTE]`, `> [!WARNING]`, etc.).
|
|
141
141
|
|
|
142
|
-
### `adfToMd(adf: AdfDoc): string`
|
|
142
|
+
### `adfToMd(adf: AdfDoc, options?: AdfToMdOptions): string`
|
|
143
143
|
|
|
144
144
|
Converts an ADF document object to a GFM string. Handles all standard ADF node and mark types and produces clean, readable output targeting GitHub Flavored Markdown.
|
|
145
145
|
|
|
146
|
+
## Options
|
|
147
|
+
|
|
148
|
+
`adfToMd` accepts an optional second argument to control rendering behaviour.
|
|
149
|
+
|
|
150
|
+
### `AdfToMdOptions`
|
|
151
|
+
|
|
152
|
+
| Option | Type | Default | Description |
|
|
153
|
+
|---|---|---|---|
|
|
154
|
+
| `mentions` | `boolean` | `true` | When `true`, renders mention nodes as the display text if available, otherwise as `@{id}`. When `false`, renders as plain text: display text if available, otherwise just the bare `{id}` without an `@` prefix. |
|
|
155
|
+
|
|
156
|
+
### Usage example
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// Render mentions as plain text instead of @-tagged references
|
|
160
|
+
const md = adfToMd(adfDoc, { mentions: false });
|
|
161
|
+
```
|
|
162
|
+
|
|
146
163
|
## TypeScript Types
|
|
147
164
|
|
|
148
|
-
All ADF types are exported for use in your own code:
|
|
165
|
+
All ADF types and option interfaces are exported for use in your own code:
|
|
149
166
|
|
|
150
167
|
```typescript
|
|
151
168
|
import type { AdfDoc, AdfNode, AdfMark, AdfInlineNode, AdfTopLevelBlockNode } from 'github-markdown-adf';
|
|
152
169
|
// Also available: ParagraphNode, HeadingNode, TableNode, PanelNode, CodeBlockNode,
|
|
153
170
|
// BulletListNode, OrderedListNode, TaskListNode, TextNode, MentionNode, ...and more
|
|
171
|
+
|
|
172
|
+
import type { AdfToMdOptions } from 'github-markdown-adf';
|
|
154
173
|
```
|
|
155
174
|
|
|
156
175
|
## Requirements
|